package cn.udesk.web.controller;

import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.udesk.core.dto.BootTablePage;
import cn.udesk.web.service.TransMonitorService;
import cn.udesk.web.utils.JsonUtils;

@RestController
@RequestMapping("/trans/monitor/")
public class TransMonitorController {

  @Autowired
  private TransMonitorService transMonitorService;

  @RequestMapping("getList.shtml")
  public String getList(Integer offset, Integer limit, HttpServletRequest request) {
    BootTablePage list = transMonitorService.getList(offset, limit);
    return JsonUtils.objectToJson(list);
  }

  @RequestMapping("getAllMonitorTrans.shtml")
  public String getAllMonitorJob(HttpServletRequest request) {
    return JsonUtils.objectToJson(transMonitorService.getAllMonitorTrans());
  }

  @RequestMapping("getAllSuccess.shtml")
  public String getAllSuccess(HttpServletRequest request) {
    return JsonUtils.objectToJson(transMonitorService.getAllSuccess());
  }

  @RequestMapping("getAllFail.shtml")
  public String getAllFail(HttpServletRequest request) {
    return JsonUtils.objectToJson(transMonitorService.getAllFail());
  }
}
